let table = document.querySelector("table");
let head_td = document.querySelector("#head_td");
let name_td = document.querySelector("#name_td");
let age_td = document.querySelector("#age_td");
let friend_td = document.querySelector("#friend_td");

function f() {
  let person = {
    name: "蔡徐坤",
    url: "img/1.gif",
    age: 30,
    hobbies: ["唱", "跳", "rap", "篮球"],
  };

  let img = document.createElement("img");
  img.src = person.url;
  head_td.append(img);

  name_td.innerText = person.name;
  age_td.innerText = person.age;

  let ul = document.createElement("ul");
  for (let hobby of person.hobbies) {
    let li = document.createElement("li");
    li.innerText = hobby;
    ul.append(li);
  }
  friend_td.append(ul);
}
